#include "graph.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(x) (ll)x.size()
#define lb(x) (x&-x)
#define rep(i,x,y) for(ll i=(x);i<=(y);i++)
#define per(i,x,y) for(ll i=(x);i>=(y);i--)
using namespace std;
using ll=long long;
using ull=unsigned long long;
using db=double;
using pll=pair<ll,ll>;
const ll N=205;
ll cnt=1,G[N][N],ans[N],dis[N][N],vs[N];
void Back(){
	Move(LastRoad(),Color());
}
ll getcolor(ll x){
	Move(x,2);
	ll c=Color();
	Back();
	return c;
}
bool find(ll u){
	vs[u]=1;
	rep(i,1,NumberOfRoads()){
		if(!G[u][i]){
			Move(i,2);
			Move(LastRoad(),3);
			return 1;
		}
	}
	rep(i,1,NumberOfRoads()){
		if(G[u][i]&&!vs[G[u][i]]){
			Move(i,2);
			ll x=LastRoad();
			if(find(G[u][i])){
				Move(x,2);
				return 1;
			}
			Move(x,2);
		}
	}
	return 0;
}
void dfs(ll u){
	vs[u]=1;
	rep(i,1,NumberOfRoads()){
		if(!G[u][i]){
			if(getcolor(i)==3){
				G[u][i]=cnt;
				Move(i,2);
				G[cnt][LastRoad()]=u;
				Back();
				dis[u][cnt]=dis[cnt][u]=1;
				break;
			}
		}
	}
	rep(i,1,NumberOfRoads()){
		if(G[u][i]&&!vs[G[u][i]]){
			Move(i,2);
			ll x=LastRoad();
			dfs(G[u][i]);
			Move(x,2);
		}
	}
}
void Inspect(int R){
	memset(dis,0x3f,sizeof dis);
	Move(1,2);
	Back();
	while(1){
		memset(vs,0,sizeof vs);
		if(!find(1)){
			break;
		}
		cnt++;
		memset(vs,0,sizeof vs);
		dfs(1);
	}
	rep(i,1,cnt){
		dis[i][i]=0;
	}
	rep(k,1,cnt){
		rep(i,1,cnt){
			rep(j,1,cnt){
				dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
			}
		}
	}
	rep(i,1,cnt){
		rep(j,i+1,cnt){
			ans[dis[i][j]]++;
		}
	}
	rep(i,1,R){
		Answer(i,ans[i]);
	}
}
